﻿using System;

namespace Sustainalytics.Portfolios.BL
{
    using System.Collections.Generic;

    using Sustainalytics.Entities;
    using Sustainalytics.Utils;

    public interface ICustomPortfolioUpdateHandler
    {
        PortfolioSaveResponseMessage AddCompaniesToPortfolio(
            Guid portfolioId,
            string portfolioName,
            PortfolioSharingStatus sharingStatus,
            ICollection<Guid> companyIds,
            PortfolioUserClaims userClaims);

        PortfolioSaveResponseMessage AddCompanyToPortfolio(
            Guid portfolioId,
            Guid companyId,
            PortfolioUserClaims userClaims);

        Portfolio AddPortfolioAndDetails(
            string portfolioName,
            PortfolioSharingStatus sharingStatus,
            ICollection<PortfolioSecuritiesRow> details,
            PortfolioUserClaims userClaims);

        Portfolio AppendDetailsToPortfolio(
            Guid portfolioId,
            ICollection<PortfolioSecuritiesRow> details,
            PortfolioUserClaims userClaims);

        List<PortfolioMatches> AddMatchesAndPortfolio(
            string portfolioName,
            PortfolioSharingStatus oldSharingStatus,
            ICollection<PortfolioMatches> details, 
            double? securityWeight,
            PortfolioUserClaims userClaims);

        void SavePortfolioMatches(List<PortfolioMatches> securities);

        void DeletePortfolioSecurity(Guid portfolioId, Guid securityId, PortfolioUserClaims userClaims);

        Portfolio ReplaceDetailsInPortfolio(
            Guid portfolioId,
            PortfolioSharingStatus sharingStatus,
            ICollection<PortfolioSecuritiesRow> details,
            PortfolioUserClaims usercClaim);

        void SaveMatchedPortfolioDetails(string portfolioName, Guid accountId, Guid userId, string userName, string userFullName);

        IList<PortfolioDetails> GetPortfolioDetailsBy(Guid portfolioId);

        IList<PortfolioMatches> GetPortfolioMatchesBy(string portfolioName, Guid accountId, Guid userId);


        IList<PortfolioMatches> SearchForSecurities(
            string securityName,
            string securityIdentifier,
            PortfolioUserClaims userClaims);

        void SetPortfolioMatching(IPortfolioMatching companySearch);

        void SetScreeningToolFilterManagement(IScreeningToolFilterManager repository);

        void SetSubscriptionManager(ISubscribeToPortfolioManagement subscriptionManagement);

        void UpdatePortfolioStatus(Guid id, PortfolioSharingStatus status, PortfolioUserClaims userClaims);

        void MarkPortfolioMatchAsValid(Guid portfolioMatchId);

        void RenamePortfolioMatches(string portfolioName, string newPorfolioName, PortfolioUserClaims userClaims);

        void RemoveSelectedPortfolioMatches(IList<Guid> portfolioMatchesIds);

        void RemoveAllPortfolioMatches(string portfolioName, Guid userId, Guid accountId);
        void AddSearchedCompany(Guid companyId, string portfolioName, PortfolioUserClaims userClaims);

        void UpdateSecurityWeight(Guid portfolioMatchId, double? newValue);

        void UpdateSecurityWeight_Unmatched(Guid portfolioMatchId, double? newValue);

        void UpdatePortfolioDetailsWeight(Guid portfolioDetailId, double? newValue); 
    }
}
